<?php


namespace App\Model;


use GuzzleHttp\Client;

class HttpRequest
{
    /**
     * 上传
     * @param $vedioUrl
     * @param $coverUrl
     * @param $title
     * @return mixed
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public static function add($vedioUrl, $coverUrl, $title)
    {

        $postData = [
            'title' => $title,
            'cover_url' => $coverUrl,
            'video_url' => $vedioUrl,
            'weight' => 1,
            'class_id' => 8,
            'amount_play' => rand(100, 999) / 100,   //1.00 -2.00
            'app_ids' => 'wx96d4f62708288707,wx0539203fd5cd99b8,wx77cd372b2aa1feab,wx8ea11fef5e05a493,wx8578315ddb81a548,wx486f0d16289a380b,wx5324ccb0bf16c997,wxd334e21dd26e43ec,wx93a1c5fae397e792,wx21dfda02eb74eadf,wx3c048229614fd2ec,wx4a46dd3422732ceb,wx9ba21118ed878398,wx0551891fff0b61ff,wxba8f82daf28ba82e,wx8f7bebc62fa454ff'
        ];
        $api = 'https://zhengnengliang01.cn/index.php/api/video/store';
        $client = new Client();
        $response = $client->request('PUT', $api, [
            'json' => $postData
        ]);
        return json_decode($response->getBody()->getContents(),true);
    }

}